<?php


namespace App\Traits;


use Carbon\Carbon;
use Illuminate\Support\Str;

trait FilePathHelper
{
    /**
     * @param string $type
     * @return string
     */
    protected function getFilePath($type = 'import')
    {
        $filePath = Carbon::now()->format('Y-m-d');

        return Str::plural($type) . '/' . $filePath;
    }

    /**
     * @param string $extension
     * @return string
     */
    protected function getFileName(string $extension)
    {
        $dayPath = Carbon::now()->format('YmdHis');

        return $dayPath . '.' . $extension;
    }

    /**
     * @param string $extension
     * @param string $type
     * @return string
     */
    protected function getAllFilePath($type = 'import', string $extension = 'xlsx')
    {
        return $this->getFilePath($type) . '/' . $this->getFileName($extension);
    }
}
